<!DOCTYPE html>
<html>
	<head lang="en">
		<meta charset="UTF-8">
		<title>课工场论坛列表</title>
		<link href="css/bbs.css" rel="stylesheet">
	</head>
	<body>
		<div class="bbs">
			<header><span>我要发帖</span></header>
			<section>
				<ul></ul>
			</section>
			<div class="post">
				<input class="title" placeholder="请输入标题（1-50个字符）">
				所属版块：<select>
					<option>请选择版块</option>
					<option>电子书籍</option>
					<option>新课来了</option>
					<option>新手报到</option>
					<option>职业规划</option>
				</select>
				<textarea class="content"></textarea>
				<input class="btn" value="发布">
			</div>
		</div>
		<script src="js/jquery-1.12.4.js"></script>
		<!-- <script src="js/bbs.js"></script> -->
		<script>
			$(function(){
				$("div.bbs header span").click(function(){
					$("div.post").show();
				});
				
				var arr=new Array("tou01.jpg","tou02.jpg","tou03.jpg","tou04.jpg");
				$("div.post input[value]").click(function(){
					var myDate=new Date;
				    var $li=$("<li></li>");
					var num=parseInt(Math.random()*4);
					var currentDate=myDate.getFullYear()+"-"+parseInt(myDate.getMonth()+1)+"-"+myDate.getDate()+" "+myDate.getHours()+":"+myDate.getMinutes();
					var $divimg=$("<div><img src=images/"+arr[num]+"></div>");
					var $h1=$("<h1>"+$("div.post input:first").val()+"</h1>");									
					var $p=$("<p><span>版块："+$("div select").val()+"</span><span>发表时间："+currentDate+"</span></p>");
					$($li).append($divimg);
					$($li).append($h1);
					$($li).append($p);
					$(".bbs section ul").append($li);					
					
					$(".post .content").val("");
					$(".post .title").val("");
					$(".post").hide();
				});			
			});
			
		</script>
	</body>
</html>
